<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%     
	String path = request.getContextPath();     
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";     
%>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>修改运维记录</title>
    <base href="<%=basePath%>"/>
    <%@ include file="../../cuv_include.jsp"%>
    <style type="text/css">
  		fieldset,legend,form,table,tr,td,textarea{margin:0;padding:0}
  		form label {font-weight:bold;}
    	table{margin:10px 10px};
  		td{line-height: 40px;}
		input[type="text"]{width:250px;}
		input[type="password"]{width:250px;}
		input[type="textarea"]{width:250px;}   		
    </style>
    <script language="JavaScript" type="text/javascript" src="<%=basePath%>js/my97/WdatePicker.js" defer="defer"></script> 
	<script type="text/javascript">
	  $(document).ready(function(){
	        var options = {dataType: 'json', beforeSubmit: beforeSubmit, success: process};
	        $("#itemForm").submit(function(){
	            $(this).ajaxSubmit(options);
	            return false;
	        });
	  });
	  
      function beforeSubmit() {
    	  if(isEmpty($("#doTime").val())) { $('#error_label').text("错误信息：运维时间不能为空！"); 
    	  	$("#p_error").show();
    	  	$("#btn_insert").removeAttr("disabled");
        	return false; }
 	      if(isEmpty($("#endTime").val())) { $('#error_label').text("错误信息：运维结束时间不能为空！"); 
	  	  	$("#p_error").show();
		  	$("#btn_insert").removeAttr("disabled");
	    	return false; }
 	      if(!validateSize($("#title").val(), 0, 100)){
 	  		$('#error_label').text("标题长度必须在0~100字符之间，一个汉字为两个字符"); 
 	  		$("#p_error").show();
 		  	$("#btn_insert").removeAttr("disabled");
 	  	  }
 	  	  if(!validateSize($("#result").val(), 0, 200)){
 	  		$('#error_label').text("运维结果长度必须在0~200字符之间，一个汉字为两个字符"); 
 	  		$("#p_error").show();
 		  	$("#btn_insert").removeAttr("disabled");
 	  	  }
          return true;
      }

    function process(responseJson) {
      if(responseJson.code == 0) {
          $('#error_label').text("错误信息：" + responseJson.message);
          $("#p_error").show();
          return;
      }
      var qs = $("#qs").val();
      location.href = "<%=basePath%>req/operationlog/userlist.do?" + qs;
    }	  
	</script>    
  </head>
  
  <body>
  <div>
    <fieldset>
      <legend>修改运维记录：</legend>
      <form id="itemForm" method="post" action="req/operationlog/edit.do">
        <input id="qs" name="qs" type="hidden" value="${qs}"/>
        <input type="hidden" name="id" value="${operationLog.id}" />
        <input type="hidden" name="title" value="${operationLog.title}" />
        <input type="hidden" name="createTime" value="${operationLog.createTime}" />
        <input type="hidden" name="operationUserEn" id="operationUserEn" value="${operationLog.operationUserEn }" />
        <input type="hidden" name="operationUserCn" id="operationUserCn" value="${operationLog.operationUserCn }" />
        <p id = "p_error" style = "margin:10px 10px;">
            <label id="error_label" style="color:red;"></label>
        </p>
        <table>
            <tr>
            <td><label for="title">标题：</label></td>
            <td>
            	<input type="text" name="title" id="title" disabled="disabled" value="${operationLog.title }" />
            	<font color="red">&nbsp;*&nbsp;&nbsp;</font>
            	<label for="title">0～100位</label>
            </td>
          </tr> 
          <tr>
            <td><label for="operationUserCn">运维人员：</label></td>
            <td>
              <input type="text" name="operationUserCn" id="operationUserCn" value="${operationLog.operationUserCn }" disabled="disabled" size="20"/>
              <font color="red">&nbsp;*&nbsp;&nbsp;</font>
              <label for="value">小于100位</label>
            </td>
          </tr>
          <tr>
            <td><label>运维时间：</label></td>
            <td>
                <input type="text" name="doTime" id="doTime" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" class="Wdate" value="${operationLog.doTime}" />
            	<font color="red">&nbsp;*&nbsp;&nbsp;</font>
            </td>
          </tr>    
          <tr>
            <td><label>运维结束时间：</label></td>
            <td>
                <input type="text" name="endTime" id="endTime" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" class="Wdate" value="${operationLog.endTime}" />
            	<font color="red">&nbsp;*&nbsp;&nbsp;</font>
            </td>
          </tr>             
          <tr>
            <td valign="top"><label for="content">运维内容：</label></td>
            <td valign="top"><textarea name="content" id="content" cols="60" rows="10"><c:out value="${operationLog.content }"/></textarea>
            <font color="red">&nbsp;*&nbsp;&nbsp;</font></td>
          </tr>       
          <tr>
            <td valign="top"><label for="result">运维结果：</label></td>
            <td valign="top"><textarea name="result" id="result" cols="60" rows="10"><c:out value="${operationLog.result }"/></textarea>
            <font color="red">&nbsp;*&nbsp;&nbsp;</font></td>
          </tr>                     
          <tr>
            <td></td>
            <td>
            	<input type="submit" id="btn_insert" value="提交" style="width:80px;" />
            	<input type="button" id="btn_back" value="返回" onclick="history.back();" style="width:80px;" />
            </td>
          </tr>
        </table>
      </form>
    </fieldset>
  </div>    
  </body>
</html>